package com.z6pin.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Service;

import com.z6pin.entity.Users;
import com.z6pin.mapper.UsersMapper;
import com.z6pin.service.UserService;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	UsersMapper userMapper;
	
	@Autowired
	static AsyncTaskService asyncTaskService;
	
	@Override
	public List<Users> getAll() {
		System.out.println("访问根路径");
		List<Users> userList = userMapper.getAll();
		return userList;
	}

	@Override
	public List<Users> reduce(Users user) {
		/*
		Users userEntity= userMapper.getOne(user.getId());
		
		if(userEntity.getAccount()>5) {
			int count = userMapper.descAccount(user);
			System.out.println(count);
		}
		*/
		List<Users> userList = null;//userMapper.getAll();
		return userList;
	}
	
	public void useReduceTask() {
		try {
			for(int i=0;i<500;i++) {
				asyncTaskService.executeAysncTaskReduce(i);
			}
		}catch(Exception e) {
			System.out.println(e.getMessage());
		}
		
	}

}
